package com.example.backend.dto;

import lombok.Data;

import java.time.Instant;
import java.util.List;
import java.util.Map;

/**
 * 搜索响应DTO
 */
@Data
public class AdvancedSearchResponse {
    
    private List<TicketSearchResult> tickets;
    private Long totalElements;
    private Integer totalPages;
    private Integer currentPage;
    private Integer pageSize;
    private SearchMetadata metadata;
    
    /**
     * 工单搜索结果
     */
    @Data
    public static class TicketSearchResult {
        private Long id;
        private String ticketNumber;
        private String title;
        private String description;
        private String status;
        private String priority;
        private String source;
        private String categoryName;
        private String customerName;
        private String assignedToName;
        private String createdByName;
        private Instant createdAt;
        private Instant updatedAt;
        private Instant dueDate;
        private Instant resolvedAt;
        private Instant closedAt;
        private Integer satisfactionScore;
        private Double estimatedHours;
        private Double actualHours;
        private Boolean isPublic;
        private Boolean isEscalated;
        private Long commentCount;
        private Long attachmentCount;
        private Map<String, Object> customFields;
        private Double relevanceScore; // 全文检索相关度分数
    }
    
    /**
     * 搜索元数据
     */
    @Data
    public static class SearchMetadata {
        private Long searchTimeMs;
        private String searchQuery;
        private List<String> appliedFilters;
        private Map<String, Long> facetCounts; // 各条件的结果数量
        private List<String> suggestions; // 搜索建议
        private Boolean hasMoreResults;
        private String nextPageToken;
    }
}
